import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.InputMismatchException;

/**
 * @author Egor Kulikov (egor@egork.net)
 */
public class TaskK {
	@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
	private InputReader in;
	private PrintWriter out;

	private void solve() {
		int arraySize = /*100;*/in.readInt();
		int queryCount = /*100;*/in.readInt();
		int[] array = /*new int[arraySize];*/in.readIntArray(arraySize);
//		Random rnd = new Random(239);
//		for (int i = 0; i < arraySize; i++)
//			array[i] = rnd.nextInt(10001) - 5000;
		IntervalTree tree = new IntervalTree(arraySize, array);
		for (int i = 0; i < queryCount; i++) {
			int value/*;*/ = in.readInt();
//			if (rnd.nextBoolean())
//				value = 0;
//			else
//				value = rnd.nextInt(10001) - 5000;
			int from = /*rnd.nextInt(arraySize);*/in.readInt();
			int to = /*rnd.nextInt(arraySize);*/in.readInt() + 1;
			if (value == 0) {
				out.println(tree.getType(from, to));
//				if (tree.getType(from, to) != getType(array, from, to))
//					throw new RuntimeException();

			} else {
				tree.putValue(from, to, value);
//				putValue(array, from, to, value);
			}
		}
	}

	private int getType(int[] array, int from, int to) {
		int type = 3;
		for (int i = from + 1; i < to; i++) {
			if (array[i] > array[i - 1])
				type &= 1;
			else if (array[i] < array[i - 1])
				type &= 2;
		}
		return type;
	}

	private void putValue(int[] array, int from, int to, int value) {
		for (int i = from; i < to; i++)
			array[i] = value - array[i];
	}

	public static class IntervalTree {
		private final int[] left;
		private final int[] right;
		private final boolean[] reverse;
		private final int[] value;
		private final int[] type;

		public IntervalTree(int size, int[] array) {
			left = new int[4 * size];
			right = new int[4 * size];
			value = new int[4 * size];
			reverse = new boolean[4 * size];
			type = new int[4 * size];
			init(0, size, 0, array);
		}

		private void init(int left, int right, int root, int[] array) {
			this.left[root] = left;
			this.right[root] = right;
			if (right - left > 1) {
				init(left, (left + right) / 2, 2 * root + 1, array);
				init((left + right) / 2, right, 2 * root + 2, array);
				type[root] = uniteTypes(root, type[2 * root + 1], type[2 * root + 2]);
			} else {
				value[root] = array[left];
				type[root] = 3;
			}
		}

		private int uniteTypes(int root, int leftType, int rightType) {
			if (leftType == 4)
				return applyReverse(rightType, root);
			if (rightType == 4)
				return applyReverse(leftType, root);
			if ((leftType & rightType) == 0)
				return 0;
			int leftLastValue = getValue(right[2 * root + 1] - 1, 2 * root + 1);
			int rightFirstValue = getValue(left[2 * root + 2], 2 * root + 2);
			int curType;
			if (leftLastValue > rightFirstValue)
				curType = 2;
			else if (leftLastValue == rightFirstValue)
				curType = 3;
			else
				curType = 1;
			int type = leftType & rightType & curType;
			return applyReverse(type, root);
		}

		private int applyReverse(int type, int root) {
			if (reverse[root]) {
				if (type == 1 || type == 2)
					type = 3 - type;
			}
			return type;
		}

		public void putValue(int left, int right, int value) {
			putValue(left, right, value, 0);
		}

		private void putValue(int left, int right, int value, int root) {
			if (left >= this.right[root] || right <= this.left[root])
				return;
			if (left <= this.left[root] && right >= this.right[root]) {
				if (this.right[root] - this.left[root] == 1) {
					this.value[root] = value - this.value[root];
					return;
				}
				this.value[root] = value - this.value[root];
				this.reverse[root] = !this.reverse[root];
				if (type[root] == 1 || type[root] == 2)
					type[root] = 3 - type[root];
				return;
			}
			putValue(left, right, value, 2 * root + 1);
			putValue(left, right, value, 2 * root + 2);
			type[root] = uniteTypes(root, type[2 * root + 1], type[2 * root + 2]);
		}

		private int getValue(int position, int root) {
			if (left[root] > position || right[root] <= position)
				return 0;
			if (right[root] - left[root] == 1)
				return value[root];
			int value = getValue(position, 2 * root + 1) + getValue(position, 2 * root + 2);
			if (this.reverse[root])
				value = this.value[root] - value;
			else
				value = this.value[root] + value;
			return value;
		}

		public int getType(int left, int right) {
			return getType(left, right, 0);
		}

		private int getType(int left, int right, int root) {
			if (left <= this.left[root] && right >= this.right[root])
				return type[root];
			if (left >= this.right[root] || right <= this.left[root])
				return 4;
			return uniteTypes(root, getType(left, right, 2 * root + 1), getType(left, right, 2 * root + 2));
		}
	}

	public static void main(String[] args) {
		new TaskK().run();
	}

	private TaskK() {
		@SuppressWarnings({"UnusedDeclaration"})
		String id = getClass().getName().toLowerCase();
		//noinspection EmptyTryBlock
		try {
//			System.setIn(new FileInputStream(id + ".in"));
//			System.setOut(new PrintStream(new FileOutputStream(id + ".out")));
//			System.setIn(new FileInputStream("input.txt"));
//			System.setOut(new PrintStream(new FileOutputStream("output.txt")));
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
	}

	private void run() {
		//noinspection InfiniteLoopStatement
//		int testCount = in.readInt();
//		for (int i = 0; i < 10000; i++)
//		while (true)
			solve();
		exit();
	}

	@SuppressWarnings({"UnusedDeclaration"})
	private void exit() {
		out.close();
		System.exit(0);
	}

	@SuppressWarnings({"UnusedDeclaration"})
	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public int[] readIntArray(int size) {
			int[] array = new int[size];
			for (int i = 0; i < size; i++)
				array[i] = readInt();
			return array;
		}

		public long[] readLongArray(int size) {
			long[] array = new long[size];
			for (int i = 0; i < size; i++)
				array[i] = readLong();
			return array;
		}

		public double[] readDoubleArray(int size) {
			double[] array = new double[size];
			for (int i = 0; i < size; i++)
				array[i] = readDouble();
			return array;
		}

		public String[] readStringArray(int size) {
			String[] array = new String[size];
			for (int i = 0; i < size; i++)
				array[i] = readString();
			return array;
		}

		public char[][] readTable(int rowCount, int columnCount) {
			char[][] table = new char[rowCount][columnCount];
			for (int i = 0; i < rowCount; i++) {
				for (int j = 0; j < columnCount; j++)
					table[i][j] = readCharacter();
			}
			return table;
		}

		public void readIntArrays(int[]... arrays) {
			for (int i = 0; i < arrays[0].length; i++) {
				for (int j = 0; j < arrays.length; j++)
					arrays[j][i] = readInt();
			}
		}
	}
}
